home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DRIVES.SWG / 0045_Available Drives.pas < prev    next >
Pascal/Delphi Source File  |  1993-09-26  |  2KB  |  48 lines

  1. (*
  2. ===========================================================================
  3.  BBS: Canada Remote Systems
  4. Date: 08-29-93 (15:41)             Number: 36579
  5. From: KENT BRIGGS                  Refer#: NONE
  6.   To: HOWARD HUANG                  Recvd: NO
  7. Subj: CHECK AVAILABLE DRIVES         Conf: (1221) F-PASCAL
  8. ---------------------------------------------------------------------------
  9.  -=> Quoting Howard Huang to All <=-
  10.  
  11.  HH> Does anyone know how to check if a drive is valid without accessing
  12.  HH> it to see? For example, if the available drives on a system are: A, B,
  13.  HH> C, E. How do you check if drive A is installed without having the
  14.  HH> floppy drive lights go on. I use TP6, so if you include a sample code,
  15.  HH> could you make it compatible with it.
  16.  
  17.  Howard, here's what I use:
  18. *)
  19. program show_drives;
  20. uses dos;
  21. var
  22.   reg: registers;
  23.   drv: array[1..3] of byte;
  24.   drvlist: string[26];
  25.   fcb: array[1..37] of byte;
  26.   i: integer;
  27. begin
  28.   drvlist:='';
  29.   for i:=1 to 26 do         {Try drives A..Z}
  30.   begin
  31.     drv[1]:=i+64;           {A=ASCII 65, etc}
  32.     drv[2]:=ord(':');
  33.     drv[3]:=0;
  34.     reg.ax:=$2906;          {DOS function 29h = Parse Filename}
  35.     reg.si:=ofs(drv[1]);    {Point to drive string}
  36.     reg.di:=ofs(fcb[1]);    {Point to File Control Block}
  37.     reg.ds:=dseg;
  38.     reg.es:=dseg;
  39.     msdos(reg);             {DOS Interrupt}
  40.     if reg.al<>$ff then drvlist:=drvlist+chr(i+64);
  41.   end;
  42.   writeln('Available drives = ',drvlist);
  43. end.
  44.  
  45. ___ Blue Wave/QWK v2.12
  46. --- Renegade v07-17 Beta
  47.  * Origin: Snipe's Castle BBS, Waco TX   (817)-757-0169 (1:388/26)
  48.